package interceptor;

import java.text.DateFormat;
import java.util.Date;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;

public class InterceptorSaludo implements Interceptor{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Override
	public void destroy(){
		
	}
	@Override
	public void init(){
		
	}
	@Override
	public String intercept(ActionInvocation actionInvocation) throws Exception
	{
		System.out.println("Hola desarrollador");
		String actionName = (String)ActionContext.getContext().get(ActionContext.ACTION_NAME);
		String tiempoActual = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM).format(new Date());
		System.out.println("Ejecutando " + actionName + " a las " + tiempoActual);
		return actionInvocation.invoke();
	}

}
